$(function(){
    obj.init();
});

var obj = new function(){
    'use strict';
    return {
        dataGrid: null,
        dom: {
            search: null,
            confirm: null
        },
        callback: null,
        param: null,
        init: function () {
            this.callback = xhTool.getQuery('callback');
            this.param    = xhTool.getQuery('param');

            this.dom.search  = $('#bt_list_search');
            this.dom.confirm = window.top.xhTop.getModalConfirmDom();

            this.dataGrid = new xhDataGrid($('#list'), 'School/getDgData', {support: 1});
            this.dataGrid.parseToolbar().init().activeBtn(this.dom.confirm, null, 'bs');

            this.listener();
        },
        listener: function () {
            var $this = this;
            //查询
            $this.dom.search.click(function(){
                $this.funObj().search();
            });
            xhTool.bindDocKeyDown($this.dom.search);
            //确认按钮，回调
            $this.dom.confirm.click(function() {
                window.top.xhTop.closeModal();
                eval('window.top.xhTop.getActiveFrame().' + $this.callback).call(this, $this.dataGrid.getSelectValues('iSchoolId'), $this.param);
                // window.top.xhTop.getActiveFrame()[$this.callback].call(this, $this.dataGrid.getSelectValues('iSchoolId'));
            });
        },
        funObj: function(){
            var $this = this;
            return {
                search: function () {
                    $this.dataGrid.reload({
                        search: {
                            vague: xhExtra.getValue($('#list_search_vague'))
                        }
                    });
                }
            }
        }
    }
}

